Yes that is possible.No professor would take it easy if his/her PhD candidate has to leave in the middle. Both of you spend significant amount of time in discussing projects, goals etc. You have to inform the professor and then the department to withdraw from the institute.
Sunny Kumar, Assistant Professor, PhD in natural sciences
Source: Quora Digest