The short and direct answer to this question is: absolutely not! Never try it, it would be extremely hazardous.
There are several reasons for this:
1) Gas appliances must be vented; electric fireplaces do not.
2) Clearance requirements are necessary for gas units, as they produce significantly more heat and get much hotter than an electric appliance.
3) Any UL or safety listings would be non-existent with an electric to gas conversion.
4) No manufacturer’s warranty would cover this type of installation.
5) An electric fireplace is not designed to withstand a direct flame.
If you’re interested in converting an electric fireplace to gas, DON’T! Think replacement, not conversion! Since there are many sizes and styles of gas fireplaces, the odds are high that you will be able to find a unit that is similar in height and width dimensions, with a similar electric fireplace footprint. However, because of the firebox and burner assembly, the depth of a gas fireplace will be more than the depth of an electric. Also, remember that a gas model will require a vent pipe connection, either horizontally or vertically, to the outside. Most gas units will require a minimum of 9 – 10 inches of space for these venting components to be correctly installed.