Hmmm... Tau Rail guns: Strength 10, AP 1, 72" Range.
Las Cannon: Strength 9, AP 2, 48" Range.
Rail gun wins hands down. And don't get me started on Rail rifle versus Las guns.
This aside, I think the sci-fi lore of Mass Effect actually defines it best. For one thing, they are designed for different things, and each has an advantage over the other.
Lasers travel at the speed of light, so they will hit their target. However, their range is limited. Over distance the light slowly refracts off space particles and what not. So, at a closer range, they will hit smaller targets very accurately. In other words, lasers will provide an excellent point defence against incoming fighters and bombers, missiles and perhaps smaller frigates.
My understanding of rail technology is that they fire slugs and huge velocity through magnets. So you have the potential of greater kinetic force on impact, but, even at crazy speeds, in space combat which is likely to be fought over huge distances, they could still be reasonably inaccurate. Also, because you are relying on kinetic energy, it could hypothetically be possible to design a shield to stop them. Railguns also have the disadvantage of requiring ammunition and that the bigger ones are essentially part of the ship, so require the entire ship to maneuverer in order to fire.