Both seem to mean borrowing an employee from another company but not exactly the same for both cases.
派遣 refers to sending a worker to another company while he/she is still employed by the original company. If someone works under the command of Company X but is paid salary by Company Y, he/she is called a 派遣社員. This can happen in various forms, but typical, "so-called" 派遣社員's are employees of large 派遣会社 (temporary staff agencies) dedicated for offering 派遣. They engage in various types of (sometimes unimportant, sometimes special) labor, but they usually don't have enough chances to get promoted. Despite its own advantages, generally speaking, 派遣 is not seen as an ideal style of working.
出向 is not a legal term, but it basically refers to temporarily sending someone to an associated company/office for various reasons. A 出向社員 is employed by the new company, but expected to go back to their original workplace usually after a few months or years. One important difference is that 出向 is often seen as a good chance to develop the career of an elite worker. In the case of 出向, one may be sent as a manager or even a board member of the new company. Kachō Kōsaku Shima is a manga which depicts a salaryman who experiences a number of 出向's within an imaginary conglomerate, until he finally becomes a president. (There are negative 出向, too.)
A 派遣会社 is basically a temp agency. 派遣, in this case, is being sent out (assigned/dispatched) temporarily to a company which has a contract with the agency for temporary workers.
出向 is simply one department of a company or the company itself 'loaning' their employee to another department or another company (An arrangement among peers). This term can be several months or even a couple of years. The employee who is 'on loan' essentially becomes an employee of the company or department they are being loaned to for this term.
A is a permanent employee at Alright Temp Agency in Tokyo.
B registers with Alright Temp Agency as a 'dispatch worker'.
A gets sent to help start a new Alright Temp Agency in Osaka, to help train workers and provide support for a period until their expertise is no longer required (出向).
B gets a temporary assignment at a nearby restaurant chain on Tuesday and another assignment to make bento boxes at another company on Thursday (派遣).
So, the main difference is whether you are specifically a 'worker specifically assigned to short-term contracts through a temp agency' or 'a permanent employee who is, for whatever reason, temporarily assigned to another location'.