A Japanese commuter train has derailed and smashed into an apartment building , killing at least 37 people and injuring more than 200 .