The two sentences are different in meaning. I'll add "the cat" to each sentence for clarity. In "Something has been done by the cat", the cat has carried out an action, like "the cat has scratched me". In "Something has been done to the cat", something else has carried out an action against the cat, like "I scratched the cat". Hopefully that's clear enough (if a little wordy).