Use a relay or buy a converter. The relay is usually quick and dirty, since everyone has relays laying around, right? I once had to do this for an array of 24 photocells...what a PITA that was.
I'm using a Carlo Gavazzi solid state relay but for some reason when I energize the SSR, the 24V dc signal that I want to feed into the PLC is not getting through the relay.
I would expect the above wired to a transistor sensor would pose problems, but if the sensor is a dry contact, that power relay might work as long as it leaks less than the turn off current/voltage of the input point.
It is certainly not the kind of relays I have lying around. You can switch the polarity with a single transistor of modest size to go solid state, but I would have to defer to others on the details, and it all depends on those darn specs...