President Obama made his first public comments on the NSA’s spying on phone records and Internet data.