There is one input coming into the car from the Tank (telling it how much fuel is left). And there is another value that is saved in the car's memory. If the value coming from Tank and the one saved in the car is 'different' by a big scale, then the older value is over written by the one coming from the tank.
But since the car is always moving and the reading coming from the tank cannot be trusted (because of the movements) the computer of the car drops the needle based on the mileage you're getting (it is calculating mileage already). The mileage calculated is so accurate that its only fare to drop the needle based on that.
This is what happens when you're on CNG. On CNG, the petrol needle still drops, why? Because the fuel is decreasing in the tank? no? Because the computer is calculating based on the average a person is getting. But when the value in the memory drops way below and the input from the tank is higher, it adjusts it accordingly (if the difference is huge).