Putting a LED H4 instead of halogen will have an absolutely crap output of light intensity and beam shape and likely to cause glare. The position and the shape of the light emitting surface is very different.
In Europe these are illegal, the car would fail roadworthiness test and in most countries police stop these cars and void their roadworthiness on the spot. Thank god, I say, having seen the initial proliferation of the crap Chinese HID and LED bulbs, which were a nightmare to look at. Fortunately they have now mostly disappeared from the roads.
Agreed. The headlight units that are made for H4 (or any other type of) halogen lamps were made to have the filament in just the right spot. With "just the right spot", that means there's very very little play. Having the filament only slightly out of alignment (usually with cheap bulbs) means you're causing glare to the oncoming traffic. LEDs won't even come close to emulating a tiny tungsten filament, and that's why retrofit LED bulbs are illegal in Europe to this day, even including the signalling and all rear lights (exempt are license plate lighting bulbs, but only if you mount an allowed colour).
Headlight spread pattern is part of the annual roadworthiness test ("MoT" in Britain) and it can make it fail meaning the car is no longer allowed on public roads until it's repaired and retested.
For us (EU) it's easy to know if bulbs are sold legally. Look at the base of the lamp and in the brand and type desciption there should be and encircled E (not necessarily round) with a numeral, "E1" in the example below:
This indicates this lamp has type approval from a notified body and complies with the ECE-regulations. I assume that other parts of the world use their own regulations and markings, so look for those. On retrofit LED bulbs or rubbish incandescent lamps, they're likely absent. Don't use those. Over here, even very cheap H4 bulbs (costing less than € 2) have approval, but since it's only a type approval, it might mean that regular production batches may not completely comply, so it's safest to use big name branded lamps, even if you have to pay a hefty premium. I've seen those cheap H4 bulbs having a remarkable bend in the glass right above the metal base that can only mean they cause glare... Do yourself and oncoming traffic a favour and use good bulbs.
Lamp units themselves also need ECE approval, so as long as a made-for-LED unit complies with the regulations, there's nothing standing in the way for the car manufacturers to use them on new designs in the EU. Retrofit LED bulbs in units made for incandescents are a no no. Some popular cars have aftermarket replacement light units available for them that alter the appearance but do comply with ECE regulations. If those are LED units, then over here that's the only legal way into LED lighting on a car made in the incandescent bulb area. If not, don't do it.