can you play a piece of music arranged for harpsichord but play it on piano and can you play a piece of music arranged for a piano but play it on a harpsichord?
to summarize, are keyboard instruments interchangeable in their arrangements?
You certainly can play music originally written and arranged for harpsichord on a piano without modification: All the commonly used keyboard instruments -harpsichord, clavichord, various types of organ, etc share the same keyboard layout. (Organs have foot pedals for playing bass notes, so organ music is not usually directly transferable to the piano.)
Bach indicated that his music could be played on any keyboard instrument, including harpsichord, clavichord, and organ. (The piano, newly invented in Italy, was unknown in Bach’s native Germany when the first book was published.) The collection takes advantage of the knowledge that though keyboard instruments have different mechanisms and produce distinctive sounds, any reasonably competent player can move from one to another without difficulty.
That being said, because of the differences in sound and structure between the harpsichord and the piano, decisions and adjustments must be made by the modern pianist when playing Bach's works.
Among the most controversial and problematic of those decisions is regarding the use of the pedals on modern pianos: Bach's harpsichords did not have such pedals, and so purists maintain that pedals must not be used when playing Bach's works on a modern piano. Others maintain that since certain parts of Bach's music can be improved through the use of pedals, they can/should be used - with careful consideration.
The answer from @user45421 has more details about adjustments that need to be made.
Here is an interesting note regarding this discussion: Bach and the Early Pianoforte - AllMusic Review
It has been known for some time that Bach knew of and played early examples of the piano, essentially invented by Bartolomeo Cristofori in the early 18th century, and several recordings have experimented with performances of Bach on a Cristofori piano or one by Cristofori's primary German follower, Gottfried Silbermann. This release by Italian historical keyboardist Luca Guglielmi goes farther in its ambitions, even suggesting that the results militate in favor of performing Bach on the modern piano rather than on the generally accepted harpsichord. Several pieces of evidence are marshaled in favor of the idea that period piano performance is not just a novelty but desirable... Concluding: The harpsichord remains the consensus choice for the performance of Bach's keyboard music aside from that for organ.
Vice-versa - Piano to harpsichord, is a different story, because of the extended range and capabilities of the modern piano, as opposed to the harpsichord.
Harpsichords usually have two manuals so you can play overlapping voices with some notes in unison. That can be hard to convincingly bring across on a piano. Pianos have a larger range than harpsichords. If piano music goes there, you'll have a problem following on the harpsichord.
Sustain and attack are quite different, and part of the reason you have two manuals on a harpsichord is that you cannot indicate voicing by dynamics, and a difference in phrasing is also hard to accomplish.
So as a rule, adequate transfer of more complex music is not trivial in either direction.
Leaving out the possible two-manual issue:
Harpsicord music on piano will be different, but fine. You can take an authentic approach, or you can be naughty and investigate how pedalling and non-terraced dynamics could enhance (or ruin, depending on your viewpoint) the music!
Piano music on harpsicord - not so easy. Because you HAVEN'T got the facilities mentioned in the above paragraph, which are integral to piano music. But then, you're much more likely to be a harpsicordist who only has a piano available than the other way around, aren't you?