More often than not putting any block on top of a Farmland block will turn it back into a Dirtblock.
Except when it doesn't. This happens randomly when there is no water. And only once for me. I've not been able to repeat it.
It however happens all the time when the Farmland is near water.