I'm almost 100% sure it's possible, but something tells me there's a better way of doing this depending on your use case and I think it's called Feature Stapling. I think of it as a declarative way to attach features to site definitions (yea, not really sticking it to other features but rather to site definitions, so that when a site gets created with said (or any) site definition, the feature is automatically activated).
If you'd rather only activate your Feature B when Feature A gets activated, I'd go ahead and just do it from Code.
if(feature==null)//if feature is not activated
{
site.Features.Add(featureId);//activate feature
}
and the reverse:
if(feature!=null)//if feature is activated
{
site.Features.Remove(feature.DefinitionId);//deactivate feature
}
EDIT: For Feature Stapling, keep this in mind:
The scope of the feature that does the stapling must be higher than
the features being stapled. For example, a feature at the site
collection scope can staple only features at site-level scope. So, you
can fine tune the your feature scope accordingly
A nice feature stapling walkthrough