Yes, you can apply to both types of programs at the same time. Schools will only find out about it if you apply to the same institution for both programs. Or if your letter of recommendation writers refer to both types of programs in their letters (meaning it's best to have two separate groups of LOR writers).