First, it's important to understand the difference between the "From:" header (which the recipient sees in their email client) and the sender address (which is also called the envelope return path, or the argument to the SMTP "MAIL FROM" command). The sender address is where bounce messages go when the email can't be delivered, hence the other name return path.
SMTP doesn't restrict what address you use as the sender address (except that it must by syntactically valid), but whatever SMTP client library you use might, so you'll need to check that out.
Changing the sender address is where you can do clever things to help detect email bounces and report them back to the webapp or sender. The most common thing you'll see is to encode the recipient address in the sender address, e.g. with a sender address like this: [email protected]. The MTA responsible for senderdomain.com needs to know to deliver all emails for [email protected] to [email protected] -- but that's a fairly common requirement. Then you take the email that is received, and instead of trying to work out from the bounce message in the contents (which could be in any format) who the recipient was, you can get it right from the recipient address.
You can do more complex things as well, like hashing the recipient address so it's not visible directly in the sender address, e.g. [email protected]. And you could include some identifier for the email that was sent, in case you're sending multiple emails to the same address and want to know which one bounced.
These tricks are called Variable Envelope Return Path or VERP, and are commonly implemented by mailing list software.