Some of Google Inc.’s cars were snapping up a lot more than pictures during the company’s Street View mapping project—they collected personal data, such as emails and passwords, from unencrypted Wi-Fi networks as they drove by.