If an ESN is provided, it can only be converted between Hexadecimal and Decimal formats. It cannot be turned into an IMEI unless the device is a "World Phone" containing both radios, in which case the ESN and IMEI are merely co-located in the database, not mathematically derived from one another.
An ESN is only 8 hex digits. But an IMEI is 15 decimal digits. Direct conversion is impossible without padding.
A 15-digit decimal code used globally to identify GSM, UMTS, and LTE devices. What "Fixed" Means in Conversion