How do you tell if a USB cable can transfer data?

You should check on the outside package or better ask the seller. The first item to check is the USB-cable supplied with your smartphone. It should be data-transfer compatible.