In my case I have an application that should transfer ethers. Is it possible that msg.sender deposits ether from another account? For instance I have all information for account A and account B. Account A calls a function of the smart contract and in that a specific amount of ethers will be transfered to A from B. B receives for this a token. How can this be implemented?
No, that's not possible. When sending a transaction, it is always signed with one private key and that account is then typically also broadcasts the transaction. You can't withdraw funds from another account without using that account's private key for signing an explicit transaction.
To accomplish something like what you want, you can have B transfer Ethers to a contract which keeps the Ethers until, with some logic, it transfers them to A.
I voted for Lauri's answer. Just to amplify it, think of the contract as a machine like an ATM or one-arm bandit. It can conceivably do anything it wants with the funds that are inside the machine, including rules such as "A" wins, so "B" pays, but there is nothing it can do to make a player move funds from their wallet to the machine.
To accomplish rules along those lines, the usual pattern would be for all players to commit their funds to the contract, then the contract uses rules to account for transfers as internal procedures. When permissible, the players withdraw funds.
Hope it helps.