If you want to travel from North Korea to China by train, you can make use of one of the direct trains running four times per week between Pyongyang (North Korea) and Beijing (China). The journey time is about 30 hours.
This route seems to be open for individual travellers.
If you want to travel from North Korea to Russia by train, you have a weekly connection by long-distance night train from North Korea to Moscow.
Twice per month by cars of North Korean national railways from Pyongyang to Moscow. And twice per month by cars of Russian railways from Tumangang to Moscow. Tumangang is the border station between Russia and North Korea, located in North Korea. From Tumangang you have a direct connection to Pyongyang.
Since 2017 it seems to be possible for individual travellers to enter North Korea via this route. But your organized trip in North Korea has to fit the departure/arrival times of the trains from/to Moscow. Your experience is welcome!