In the UK, it’s now illegal. Specifically, you should not put an LED unit behind a lens that's not designed for it.
You might get away with it for full beams, but you will mess with the dipped beam pattern and cause accidents by blinding other road users. It’s not illegal to sell them, so don’t rely on that.
Since September 2018,
DVSA’s instruction to MOT testers is that LED retrofits constitute an automatic MOT fail: “An LED bulb fitted to a halogen headlamp should be rejected for 4.1.4 (c) ‘Light source and lamp not compatible’, even if the headlamp aim is within limits laid down in the requirements.”