My Nexus 6p keeps turning of when connected to wifi or cellular data I have a 5 months old nexus 6p and whenever i turn on wifi or cellular data it reboots itself. it works perfectly fine if not connected. 
pls help
Please try running device in Safe Mode. Running device in safe mode will stop third-party apps from functioning. This will test if it's caused by a third-party app. 

To run device in Safe Mode:
1. Press and Hold Power button
2. Touch and Hold Power off prompt on your screen
3. You should get a notification on your phone to reboot device in Safe Mode, then hit OK
You will notice that there's "Safe Mode" at the bottom of your screen once it reboots.

If it works in safe mode, then try uninstalling your apps one by one as this might cause the issue. If not, I'd suggest Wiping cache partition or Factory Resetting your device.