You should be fine installing Windows 10 straight from your pirated Windows 8.1. When you open the Windows 10 install, you will be prompted with a few questions, one being whether you would like to keep your files or delete them all and start fresh. So yes, you can and you will still have all of your data.