The accidents/deaths in Europe have been dropping over the years. But I think the main difference is that while trains are extremely popular in Japan, in Europe it's been for decades under attack from governments who push roads and driving instead. This leads to underfunding and hollowing out of the train services.
Classic example seen all around Europe is partial privatization where it's often some state owned company that manages the expensive rails maintenance and unprofitable (but required) train lines while private companies get the profitable lines. This often leads to public opinion that trains are subsidized too much which leads to more decline of the services.
Another complication is that Japan is one country with one system where everybody speaks same language but trains in EU have to connect different systems together and it is hard to come to unified systems and laws around trains.