Interesting comparison. That said, I suspect that most drivers will be interested in how much it costs them per mile rather than the cost per unit of energy input -- and diesel ICEs are nowhere near 100% efficient.
The calculations are fairly straightforward:
For ICEVs, to 2 decimal places there are 4.55 litres in a gallon. So the cost per mile is: (price per litre * 4.55)/miles per gallon. For example, if diesel costs £1.50/litre and your car returns 60mpg, the cost per mile is (£1.50 * 4.55)/60 = 11.4p/mile
For EVs, the cost per mile is the price per kWh/miles per kWh. For example, an EV returning 3.5 miles/kWh, that cost is 2p per mile for the most heavily subsidised home-charging rate I've seen quoted (i.e. 7p/kWh) and 17.1p/mile at 60p/kWh rapid chargers.
Of course, the costs per mile above are just examples, and you need to 'plug in' the values appropriate to whatever vehicle you're considering...