Converting accomplishes two things. One, it builds the infrastructure around hydrogen, should a different source of production be found. For instance, the high temperatures in molten salt reactors could generate sufficient heat for solid oxide electrolyzer cells to operate effectively. Two, it's much easier to capture carbon dioxide from a single source.
Hydrogen has about one hundred times the mass-based energy density of batteries, and about triple that of gasoline. Using hydrogen as a fuel makes sense where weight matters. The first hydrogen powered plane is flying. It also makes sense to use hydrogen in remote areas where it's not economic to run power lines, or where it's not practical to build nuclear to keep the heat and lights on during the dark winter months, places currently electrified with diesel.
The first hydrogen-powered locomotive is already moving freight around Calgary. Most lithium battery chemistries require heating to work half the year (except lithium titanate, which has low energy density). To replace the 20,000 liters of diesel carried by a typical North American locomotive, it would require about 15 rail cars of batteries, or about a third of the hauling capacity of the locomotive. Locomotives are never run to empty, but neither would the batteries be. North American railroads frequently run away from power infrastructure, plus adding catenary wires would require massive tunnel and bridge reconstruction throughout the continent, or a largely new fleet of railcars with diminished capacity, either of which would cost well into the tens of trillions of dollars.