AC or DC? It can matter, or it might not. Some, but not all, of the LEDs made for vehicles, include a fancy circuit to ensure that the device is not ac-dc sensitive. Many of the more expensive and powerful LEDs, as you might use in a headlamp, for instance, include a circuit so they will run on anything from 9 volts to 30 or more. This allows them to cope with commercial trucks (at 24 volts) and cars will badly adjusted voltage, etc.
A comparison with mains bulbs is not helpful in this instance, as all the mains is AC, now, (in the UK at least) so all mains LED bulbs include the necessary circuitry.
You might find with smaller 12v vehicle bulbs (wedge-type sidelights, instrument lights, etc) that the bulb is polarity sensitive, so 50% of the time you fit one it won't work. All you need do is take the bulb out, rotate it 180 degrees, and replace it. This shows that these bulbs are not sophisticated – not least because the price is affected, and there is very little room for the extra gubbins. In general, it does no harm to connect an LED the 'wrong' way round, as they are (as it says on the tin) Diodes. This only applies if you are trying the right voltage the wrong way round – no diodes will stand a reverse connection if the voltage is much higher than it was designed for.
Actually, any diode WILL work 'backwards' in this way, but only very briefly. Micro seconds, perhaps, followed by smoke … This is the Zener effect, and the Zener diodes which are designed take advantage of this effect are made with big chunks of semi-conductor welded to big lumps of light alloy (etc) to dissipate the heat produced when working in this way.
So, it SHOULD be OK to use an LED headlight on a no-battery, 'direct lighting' system. But it may be that the rear bulb, and any others, don't work. Or even if they do, it's not for long. This is because with AC the 'voltage' is actually the average over the full cycle of output. This varies from nothing to maximum, and then through zero to max the other way, and the max can easily be twice the average. The LED will struggle with this, even if there is a clever circuit. The alternator will be pumping out AMPs and if the demand does not match the supply, the voltage will go up until it does. This can happen with a dip switch, for example, as they normally have a momentary off-spot as the mechanism flicks from one side to the other.
Another effect which can be a problem, is the spikes of voltage in the whole circuit caused by the ignition set-up. With a mag you may be OK (not guaranteed, though) but any coil ignition, with points of electronic, will produce spikes of voltage much higher than the LED can cope with. Only a few microseconds, perhaps, but lethal all the same. In a more conventional set-up, the battery helps to cut the spikes down to size.
Hope this helps
Regards, Tim