You'll probably find that both rwy's (31 and 13) have the same ILS frequency, and share a DME station positioned halfway between the two thresholds.
This DME station has been altered (electronically) so it reads 0 at both thresholds, as opposed to reading zero at the station location itself. This is somehow done with a delay setting within the DME station and requires no input from the crew.
Is the ground equipment somehow smart enough to show the distance from either threshold,
Short answer, yes.