I feel the train are safer for riding. But, there is a rare chance that there is a dangerous criminal who decide to attack random passengers on the train. It is harder for many people to quickly get off a train is harder because it takes more time to stop a heavy train while it is still moving compared to a car. Some people also bring dangerous things like gas, fireworks, toxic chemicals, and weapons on local trains like subways and trams because many local trains may not check luggage before boarding them.
Most large planes check to see if people have weapons, and are not on the "do not fly list" But, trains like subways and smaller train services may not check people's luggage for weapons, or see if they were arrested for dangerous crimes in the past.