Yes there is I looked into it.
I built a dash guage system for my car I looked into mpg but didnt fancy the maths.
Most cars have obd connectors, you can get data from this, they call them pid's, you request a pid and the ecu returns it, one of the pids is engine load, this directly tells you the amount of air is entering the engine, at the same time you can get the pid for the lamda, this tells you the air/fuel ratio, knowing these 2 pieces of info you can calculate the amount of fuel entering the engine, eg a 2 litre engine at wide open throttle will use 1 litre of air per rev, at perfect fuel/air ratio of 14.7:1 the amount of fuel would be 1/14.7 about 0.06l (at less than wide open throttle you multiply the maximum amount of air by the load %), from the obd you can also get the rpm and road speed pids for the car, then you can work out the mpg.
You could just ignore the fuel/air ratio and assume its 14.7:1, most engines are pretty good now, or you could go the other way and take air temp (density) and fuel temp into consideration.
This is how manufacturers do it to get dashboard mpg.
I might have got a couple of details wrong there its a while since I looked into it but the gist is correct.
Or you could always fork out 40 quid and buy yourself a digi dash which does this and a whole load of other things from the obd connector.