First of all, not all laws are voted on (by the general population that is). Actually, most aren't so I fail to see how they portray the values of the majority as long as they don't go so much against the general tendency that people feel a need to manifest their outrage.
Laws are essentially a practical application of some abstract ideal.
They are always in a state of change and can always be improved to better portay their abstract ideological roots in a multitude of unforeseen situations.
I would not hold the laws to be the highest authority in ethics, only in our current knowledge of their application. There is a nuance here.