In Star Trek Nemesis. At the end. He died when the Scimitar exploded (he was still on that ship and the Enterprise's transporters were non operational). Brent Spiner (the actor who played Data (and Lore, and Dr. Noonien Soong, and B4, etc.)) was concerned that he had aged out of the role and has decided not to reprise it in any later films so Data was killed off by the writers of the last TNG movie.