That's quite a question
. A professional might know right off, from local knowledge already in his or her possession, from inference based on related information, from types of materials remaining at the site, if any, or from the amount of soil build-up in the hole. Other physical clues at the site might be things like out-of-place trees or remnants of shrubbery that might give an idea of age. Bricks of a certain style. Iron nails and other such often tell a really clear tale just from their style, but that says when they were made, not when the place was last used. Glassware and other household discards are great clues, and sometimes found on the surface. Beyond that they would have to dig.
If I had to guess I would generally say that anything from the last century is unlikely to be completely filled unless it was demolished. If it's just a depression in the soil then it's probably well over 100 years. 1940's I think you would be looking at something clearly identifiable as a cellar, though partially filled with debris.