There is an extension method in the Item that gives you the bucket item of your current item.
Its in the Sitecore.Buckets.Extensions
namespace in the Sitecore.Buckets.dll
assembly.
You can use it like this:
var bucketItem = Sitecore.Context.Item.GetParentBucketItemOrParent();
var urlToBucket = LinkManager.GetItemUrl(bucketItem);
You can also use the BucketManager to check if an item is contained within a bucket:
BucketManager.IsItemContainedWithinBucket(Sitecore.Context.Item)